import { reactive } from 'vue';

const formRules = {
  archiveId: [{ required: true, message: '请选择档案' }],
  startTime: [{ required: true, message: '请选择借阅开始时间' }],
  endTime: [{ required: true, message: '请选择借阅结束时间' }],
  opinion: [{ required: true, message: '请填写借阅事由' }],
};

const formState = reactive<{
  archiveId: string;
  archiveName: string;
  startTime: string;
  endTime: string;
  opinion: string;
}>({
  archiveId: '',
  archiveName: '',
  startTime: '',
  endTime: '',
  opinion: '',
});

const state = reactive<{
  appArchiveListPopupVisible: boolean;
  timePickerVisible: boolean;
  /**
   * 0没选择开始时间框还是结束时间框
   * 1 开始时间框
   * 2 结束时间框
   */
  currentSelectedTime?: 0 | 1 | 2;
}>({
  appArchiveListPopupVisible: false,
  timePickerVisible: false,
  currentSelectedTime: 0,
});

export { formState, state, formRules };
